[Previous] [Next] [Index] [Thread]

Re: netscape and /etc/passwd



On Fri, 20 Oct 1995, Automatic digest processor wrote:

> From: Michael Reuschling <reuschli@transtec.de>

> open ("/etc/passwd", 0, 0666) = 4
> ioctl (4, 0x40125401, 0xefffd514) = -1 ENOTTY (Inappropriate ioctl for device)
> fstat (4, 0xefffd588) = 0
> brk (0x349170) = 0
> read (4, "root:hNJ93kdb9E3sQ:0:1:Operator:".., 8192) = 514
> close (4) = 0

> Does anybody know, why netscape is doing this? If it would read the
> line for my uid, it would not border me, but root...

Do note that it is reading from the beginning of the file. /etc/passwd is
a line-based text file, so knowing where each line begins is nearly
impossible without buffered files (read: stdio). A stdio fgets() or
fscanf() to find the appropriate passwd line--not uncommon for most
getpwent() calls!--will likely start reading right from the beginning of
the /etc/passwd file to find the correct line. (After all, I've never 
seen a gecos field that will make *one* line of a passwd file 514 bytes. :)

=====
== Todd Vierling (tv@pobox.com): In cyberspace no one can hear you scream. ==
=== Plug: I do freelance C/Perl *IX programming and WWW design. E-mail me ===
=== Vierling's Law: The revolution won't be televised; it will be posted. ===


References: